package controllers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;

public class ActionPlayerButtonListener implements ActionListener {

	protected EmbeddedMediaPlayer mediaPlayer;
	protected int type;
	
	public ActionPlayerButtonListener(EmbeddedMediaPlayer mediaPlayer, int type){
		this.mediaPlayer = mediaPlayer;
		this.type = type;
	}

	public void actionPerformed(ActionEvent e) {
		switch (type) {
		case 0: // Lecture/Pause
			// TODO Changement du texte
			if(this.mediaPlayer.canPause()){
				this.mediaPlayer.pause();
			} else {
				this.mediaPlayer.play();
			}
			break;
		case 1: // Stop
			mediaPlayer.stop();
			break;
		case 2: // Fullscreen
			if(this.mediaPlayer.isFullScreen()){
				this.mediaPlayer.setFullScreen(false);
			} else {
				this.mediaPlayer.setFullScreen(true);
			}
			break;
		case 3:
			this.mediaPlayer.nextFrame();
			System.out.println(this.mediaPlayer.getTime());
			break;
		default:
			break;
		}
	}

}
